//
//  ORCustomTableViewCell.m
//  NewsHots
//
//  Created by rimi on 2016/12/3.
//  Copyright © 2016年 zhongshuilian. All rights reserved.
//

#import "ORCustomTableViewCell.h"

@interface ORCustomTableViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic,strong)UIView *bgView;

@end

@implementation ORCustomTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createUI];
        [self.bgView addSubview:self.titleLabel];
    }
    return self;
}

-(void)createUI{
    //创建一个UIView比self.contentView小一圈
    self.bgView = [[UIView alloc]initWithFrame:AAdaptionRect(10, 5, kBaseWidth/AAdaptationWidth() - 20, 100)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(1, 1);
    self.bgView.layer.shadowOpacity = 0.3;
    self.bgView.layer.shadowColor = [UIColor blackColor].CGColor;
    [self.contentView addSubview:self.bgView];
}

+(CGFloat)getHeight{
    //在这里能计算高度，动态调整
    return 100;
}

-(UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]initWithFrame:AAdaptionRect(20, 20, 200, 30)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"ghost";
        _titleLabel.font = AAFont(20);
        
    }
    return _titleLabel;
}

@end
